﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Ewk.Extensions.UnitTests.StringExtensionsTests
{
    [TestClass]
    public class GetWordsTests
    {
        [TestMethod]
        public void GetWords_transforms_a_string_with_words_to_an_Array_with_words()
        {
            const string sentence = "This is the sentence that should be transformed to an array of words";

            var words = sentence.GetWords();
            Assert.AreEqual(13, words.Count(), "The tranformed sentence contains 13 words.");
            
            var splitSentence = sentence.Split(' ');
            Assert.IsTrue(splitSentence.All(split => words.Contains(split.ToUpper())));
        }

        [TestMethod]
        public void GetWords_transforms_a_string_with_words_separated_by_a_dash_to_an_Array_with_words()
        {
            const string sentence = "This-is-the-sentence-that-should-be-transformed-to an array of words";

            var words = sentence.GetWords();
            Assert.AreEqual(13, words.Count(), "The tranformed sentence contains 13 words.");

            var splitSentence = sentence.Split(' ', '-');
            Assert.IsTrue(splitSentence.All(split => words.Contains(split.ToUpper())));
        }
    }
}